<?php

namespace Common\Model;
use Think\Model\RelationModel;

/**
 * 门店模型
 */
class StoreModel extends RelationModel{
    protected $_validate = array(
        array('sname','require','门店名称必须！'), //默认情况下用正则进行验证
    );
    
    protected  $_auto=array(
         array('add_time','time',self::MODEL_INSERT,'function'), // 对add_time字段在添加的时候写入当前时间戳
    );
protected $_link = array(
    'Brand' => array(
            'mapping_type' => self::BELONGS_TO,
            'class_name' => 'Brand',
            'foreign_key' => 'bid',
            'mapping_name' => 'brand',
            'mapping_fields' => 'bname',
            'as_fields' => 'bname'
        )
);
    
}

?>
